package com.xja.book.controller;

import com.xja.book.entity.BookType;
import com.xja.book.service.BookTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("bookType")
public class BookTypeController {
    @Autowired
    private BookTypeService bookTypeService;

    @RequestMapping("find")
    public String find (Model model){
        try {
            List<BookType> bookTypeList = bookTypeService.findBookType();
            model.addAttribute("bookTypeList",bookTypeList);
            return "type_list";
        }catch (Exception ex){
            ex.printStackTrace();
        }
        return "/error.jsp";
    }


}
